﻿@model TaxSettingsModel

@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Settings.Tax").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("Tax settings");
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @T("Admin.Configuration.Settings.Tax")
        </h1>
        <div class="pull-right">
            <button type="submit" name="save" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.Save")
            </button>
        </div>
    </div>


    <div class="content">
        <div class="form-horizontal">
            @Html.Action("ProjectScopeConfiguration", "Setting")
            @Html.Action("Mode", "Setting")
            @Html.ValidationSummary(false)

            <div class="panel-group">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.AllowCustomersToSelectTaxDisplayType_OverrideForProject, model => model.AllowCustomersToSelectTaxDisplayType, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.AllowCustomersToSelectTaxDisplayType)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.AllowCustomersToSelectTaxDisplayType)
                                @Html.ValidationMessageFor(model => model.AllowCustomersToSelectTaxDisplayType)
                            </div>
                        </div>
                        <div class="form-group" id="pnlTaxDisplayType">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.TaxDisplayType_OverrideForProject, model => model.TaxDisplayType, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.TaxDisplayType)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDropDownListFor(model => model.TaxDisplayType, Model.TaxDisplayTypeValues)
                                @Html.ValidationMessageFor(model => model.TaxDisplayType)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.PricesIncludeTax_OverrideForProject, model => model.PricesIncludeTax, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.PricesIncludeTax)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.PricesIncludeTax)
                                @Html.ValidationMessageFor(model => model.PricesIncludeTax)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.DisplayTaxSuffix_OverrideForProject, model => model.DisplayTaxSuffix, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.DisplayTaxSuffix)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.DisplayTaxSuffix)
                                @Html.ValidationMessageFor(model => model.DisplayTaxSuffix)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.DisplayTaxRates_OverrideForProject, model => model.DisplayTaxRates, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.DisplayTaxRates)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.DisplayTaxRates)
                                @Html.ValidationMessageFor(model => model.DisplayTaxRates)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.HideZeroTax_OverrideForProject, model => model.HideZeroTax, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.HideZeroTax)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.HideZeroTax)
                                @Html.ValidationMessageFor(model => model.HideZeroTax)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.HideTaxInOrderSummary_OverrideForProject, model => model.HideTaxInOrderSummary, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.HideTaxInOrderSummary)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.HideTaxInOrderSummary)
                                @Html.ValidationMessageFor(model => model.HideTaxInOrderSummary)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ForceTaxExclusionFromOrderSubtotal_OverrideForProject, model => model.ForceTaxExclusionFromOrderSubtotal, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ForceTaxExclusionFromOrderSubtotal)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ForceTaxExclusionFromOrderSubtotal)
                                @Html.ValidationMessageFor(model => model.ForceTaxExclusionFromOrderSubtotal)
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.TaxBasedOn_OverrideForProject, model => model.TaxBasedOn, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.TaxBasedOn)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDropDownListFor(model => model.TaxBasedOn, Model.TaxBasedOnValues)
                                @Html.ValidationMessageFor(model => model.TaxBasedOn)
                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            $("#@Html.FieldIdFor(model => model.AllowCustomersToSelectTaxDisplayType)").click(toggleTaxDisplayType);
                            toggleTaxDisplayType();
                        });

                        function toggleTaxDisplayType() {
                            if ($('#@Html.FieldIdFor(model => model.AllowCustomersToSelectTaxDisplayType)').is(':checked')) {
                                $('#pnlTaxDisplayType').hide();
                            } else {
                                $('#pnlTaxDisplayType').show();
                            }
                        }

                    </script>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        @Html.OverrideProjectCheckboxFor(model => model.DefaultTaxAddress_OverrideForProject, "pnlDefaultTaxAddress", Model.ActiveProjectScopeConfiguration)
                        @T("Admin.Configuration.Settings.Tax.DefaultTaxAddress")
                    </div>
                    <div class="panel-body">
                        <div id="pnlDefaultTaxAddress">
                            @Html.EditorFor(x => x.DefaultTaxAddress, "Address")
                        </div>
                    </div>
                </div>
                <div class="panel panel-default advanced-setting">
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShippingIsTaxable_OverrideForProject, model => model.ShippingIsTaxable, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShippingIsTaxable)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShippingIsTaxable)
                                @Html.ValidationMessageFor(model => model.ShippingIsTaxable)
                            </div>
                        </div>
                        <div class="form-group" id="pnlShippingPriceIncludesTax">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShippingPriceIncludesTax_OverrideForProject, model => model.ShippingPriceIncludesTax, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShippingPriceIncludesTax)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShippingPriceIncludesTax)
                                @Html.ValidationMessageFor(model => model.ShippingPriceIncludesTax)
                            </div>
                        </div>
                        <div class="form-group" id="pnlShippingTaxClass">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShippingTaxClassId_OverrideForProject, model => model.ShippingTaxClassId, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShippingTaxClassId)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDropDownListFor(model => model.ShippingTaxClassId, Model.ShippingTaxCategories)
                                @Html.ValidationMessageFor(model => model.ShippingTaxClassId)
                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            $("#@Html.FieldIdFor(model => model.ShippingIsTaxable)").click(toggleShipping);

                            toggleShipping();
                        });

                        function toggleShipping() {
                            if ($('#@Html.FieldIdFor(model => model.ShippingIsTaxable)').is(':checked')) {
                                $('#pnlShippingPriceIncludesTax').show();
                                $('#pnlShippingTaxClass').show();
                            } else {
                                $('#pnlShippingPriceIncludesTax').hide();
                                $('#pnlShippingTaxClass').hide();
                            }
                        }
                    </script>
                </div>
                <div class="panel panel-default advanced-setting">
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.PaymentMethodAdditionalFeeIsTaxable_OverrideForProject, model => model.PaymentMethodAdditionalFeeIsTaxable, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.PaymentMethodAdditionalFeeIsTaxable)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.PaymentMethodAdditionalFeeIsTaxable)
                                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeIsTaxable)
                            </div>
                        </div>
                        <div class="form-group" id="pnlPaymentMethodAdditionalFeeIncludesTax">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.PaymentMethodAdditionalFeeIncludesTax_OverrideForProject, model => model.PaymentMethodAdditionalFeeIncludesTax, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.PaymentMethodAdditionalFeeIncludesTax)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.PaymentMethodAdditionalFeeIncludesTax)
                                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeIncludesTax)
                            </div>
                        </div>
                        <div class="form-group" id="pnlPaymentMethodAdditionalFeeTaxClass">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.PaymentMethodAdditionalFeeTaxClassId_OverrideForProject, model => model.PaymentMethodAdditionalFeeTaxClassId, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.PaymentMethodAdditionalFeeTaxClassId)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDropDownListFor(model => model.PaymentMethodAdditionalFeeTaxClassId, Model.PaymentMethodAdditionalFeeTaxCategories)
                                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeTaxClassId)
                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            $("#@Html.FieldIdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)").click(togglePayment);

                            togglePayment();
                        });


                        function togglePayment() {
                            if ($('#@Html.FieldIdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)').is(':checked')) {
                                $('#pnlPaymentMethodAdditionalFeeIncludesTax').show();
                                $('#pnlPaymentMethodAdditionalFeeTaxClass').show();
                            } else {
                                $('#pnlPaymentMethodAdditionalFeeIncludesTax').hide();
                                $('#pnlPaymentMethodAdditionalFeeTaxClass').hide();
                            }
                        }

                    </script>
                </div>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatEnabled_OverrideForProject, model => model.EuVatEnabled, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatEnabled)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EuVatEnabled)
                                @Html.ValidationMessageFor(model => model.EuVatEnabled)
                            </div>
                        </div>
                        <div class="form-group" id="pnlEuVatShopCountry">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatShopCountryId_OverrideForProject, model => model.EuVatShopCountryId, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatShopCountryId)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDropDownListFor(model => model.EuVatShopCountryId, Model.EuVatShopCountries)
                                @Html.ValidationMessageFor(model => model.EuVatShopCountryId)
                            </div>
                        </div>
                        <div class="form-group" id="pnlEuVatAllowVATExemption">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatAllowVatExemption_OverrideForProject, model => model.EuVatAllowVatExemption, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatAllowVatExemption)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EuVatAllowVatExemption)
                                @Html.ValidationMessageFor(model => model.EuVatAllowVatExemption)
                            </div>
                        </div>
                        <div class="form-group" id="pnlEuVatAssumeValid">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatAssumeValid_OverrideForProject, model => model.EuVatAssumeValid, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatAssumeValid)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EuVatAssumeValid)
                                @Html.ValidationMessageFor(model => model.EuVatAssumeValid)
                            </div>
                        </div>
                        <div class="form-group" id="pnlEuVatUseWebService">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatUseWebService_OverrideForProject, model => model.EuVatUseWebService, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatUseWebService)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EuVatUseWebService)
                                @Html.ValidationMessageFor(model => model.EuVatUseWebService)
                            </div>
                        </div>
                        <div class="form-group" id="pnlEuVatEmailAdminWhenNewVATSubmitted">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EuVatEmailAdminWhenNewVatSubmitted_OverrideForProject, model => model.EuVatEmailAdminWhenNewVatSubmitted, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EuVatEmailAdminWhenNewVatSubmitted)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EuVatEmailAdminWhenNewVatSubmitted)
                                @Html.ValidationMessageFor(model => model.EuVatEmailAdminWhenNewVatSubmitted)
                            </div>
                        </div>
                        <script type="text/javascript">
                            $(document).ready(function () {
                                $("#@Html.FieldIdFor(model => model.EuVatEnabled)").click(toggleEUVAT);

                                toggleEUVAT();
                            });


                            function toggleEUVAT() {
                                if ($('#@Html.FieldIdFor(model => model.EuVatEnabled)').is(':checked')) {
                                    $('#pnlEuVatShopCountry').show();
                                    $('#pnlEuVatAllowVATExemption').show();
                                    $('#pnlEuVatAssumeValid').show();
                                    $('#pnlEuVatUseWebService').show();
                                    $('#pnlEuVatEmailAdminWhenNewVATSubmitted').show();
                                } else {
                                    $('#pnlEuVatShopCountry').hide();
                                    $('#pnlEuVatAllowVATExemption').hide();
                                    $('#pnlEuVatAssumeValid').hide();
                                    $('#pnlEuVatUseWebService').hide();
                                    $('#pnlEuVatEmailAdminWhenNewVATSubmitted').hide();
                                }
                            }
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
}
